pkgname=qt5-qtwayland
pkgver=5.9.1
pkgrel=6
arch="all"
url='http://qt-project.org/'
license="GPL3 LGPL3 FDL custom"
pkgdesc='Provides APIs for Wayland'
depends="qt5-qtdeclarative libxcomposite wayland qt5-qtquickcontrols qt5-qtquickcontrols2"
makedepends="qt5-qtbase-dev libxkbcommon-dev qt5-qtquickcontrols qt5-qtquickcontrols2"
source="http://download.qt.io/official_releases/qt/${pkgver%.*}/${pkgver}/submodules/${pkgname/qt5-/}-opensource-src-$pkgver.tar.xz
	0003-QtKeyExtensionGlobal-fix-export.patch"
subpackages="$pkgname-dev $pkgname-doc"

prepare() {
	mkdir -p "$srcdir"/build
	cd "$srcdir"/${pkgname/qt5-/}-opensource-src-$pkgver
	patch -p1 < "$srcdir"/0003-QtKeyExtensionGlobal-fix-export.patch
}

build() {
	cd $srcdir/build

	qmake-qt5 "$srcdir"/${pkgname/qt5-/}-opensource-src-$pkgver
	make
}

package() {
	cd $srcdir/build

	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/${pkgname}
}
sha512sums="619025f6db1234e2e85e8790ca152765696b3019414e4de1a7630ef3cb5a11fa3d0f3955f1e2e9e82f05a90a6da3a0a355c3c4de4dc0006cb91f122428031df3  qtwayland-opensource-src-5.9.1.tar.xz
2e10437899fd836b9c9d5c42ec9715cf94af54cea09a3649172b5d7497a378fdf292ba87a2eedf0b26413499a06ef03b51ea7edb31e8a37a05970823d90a10e1  0003-QtKeyExtensionGlobal-fix-export.patch"
